using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using System.Windows;

namespace MJB.UI.ContentEditor
{

    /// <summary>
    /// This is the file node that represents a file in a directory.
    /// </summary>
    public class FileNode : DependencyObject
    {
        #region Member Variables

        /// <summary>
        /// This is the name dependency property.
        /// </summary>
        public static DependencyProperty NameProperty = DependencyProperty.Register("Name",
            typeof(string),
            typeof(FileNode),
            new PropertyMetadata(String.Empty));

        /// <summary>
        /// This is the path dependency property.
        /// </summary>
        public static DependencyProperty PathProperty = DependencyProperty.Register("Path",
            typeof(string),
            typeof(FileNode),
            new PropertyMetadata(String.Empty));

        /// <summary>
        /// This is the IsDirectory property.
        /// </summary>
        public static DependencyProperty IsDirectoryProperty = DependencyProperty.Register("IsDirectory",
            typeof(bool),
            typeof(FileNode),
            new PropertyMetadata(false));

        /// <summary>
        /// This is the child nodes dependency property.
        /// </summary>
        public static readonly DependencyProperty ChildNodesProperty = DependencyProperty.Register("ChildNodes",
            typeof(ObservableCollection<FileNode>),
            typeof(FileNode),
            new PropertyMetadata(new ObservableCollection<FileNode>()));

        /// <summary>
        /// This is the parent node property.
        /// </summary>
        public static readonly DependencyProperty ParentNodeProperty = DependencyProperty.Register("ParentNode",
            typeof(FileNode),
            typeof(FileNode),
            new PropertyMetadata(null));

        #endregion
        #region Constructor

        /// <summary>
        /// Creates a FileNode.
        /// </summary>
        public FileNode()
        {
            this.ChildNodes = new ObservableCollection<FileNode>();
        }

        #endregion
        #region Public Properties

        /// <summary>
        /// Gets / sets the name property.
        /// </summary>
        public string Name
        {
            get
            {
                return (string)GetValue(NameProperty);
            }
            set
            {
                SetValue(NameProperty, value);
            }
        }

        /// <summary>
        /// Gets / sets the path property.
        /// </summary>
        public string Path
        {
            get
            {
                return (string)GetValue(PathProperty);
            }
            set
            {
                SetValue(PathProperty, value);
            }
        }

        /// <summary>
        /// Gets / sets the IsDirectory property.
        /// </summary>
        public bool IsDirectory
        {
            get
            {
                return (bool)GetValue(IsDirectoryProperty);
            }
            set
            {
                SetValue(IsDirectoryProperty, value);
            }
        }

        /// <summary>
        /// Gets / sets the parent node property.
        /// </summary>
        public FileNode ParentNode
        {
            get
            {
                return (FileNode)GetValue(ParentNodeProperty);
            }
            set
            {
                SetValue(ParentNodeProperty, value);
            }
        }

        /// <summary>
        /// Gets / sets the child nodes dependency property.
        /// </summary>
        public ObservableCollection<FileNode> ChildNodes
        {
            get
            {
                return (ObservableCollection<FileNode>)GetValue(ChildNodesProperty);
            }
            set
            {
                SetValue(ChildNodesProperty, value);
            }
        }

        #endregion

    }

}
